#!/bin/bash
n=$2
echo "import numpy as np"
echo "import matplotlib.pyplot as plt"
echo "re = ["
for i in $(seq 1 $1)   
do
    re=`./test $4 $n | grep time | ./stat`
    echo ${re#*:}   # re#*: 表示忽略re中:之前的部分
    echo ","
    n=$((n+$3))   
done
echo "];"
echo "num=np.arange($2,$n,$3)"
echo "num2=[num[i]**2 for i in range(len(num))]"
echo "plt.plot(num2,re,'r.')"
echo "plt.xlabel('n^2')"
echo "plt.ylabel('time')"
echo "plt.title('Worst-case time efficiency')"
echo "plt.grid(True)"
echo "plt.show()"
